package cn.cdu.doctor.entity;

import cn.cdu.basics.baseClass.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Arrays;

@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "doctor_scheduling")
@TableName("doctor_scheduling")
@Schema(description = "医生排班")
public class DoctorScheduling extends BaseEntity {

    private static final long serialVersionUID = 1L;

    public static final String MORNING_SHIFT = "0";
    public static final String AFTERNOON_SHIFT = "1";

    @Schema(description = "医生ID")
    private String doctorId;

    @Schema(description = "医生姓名")
    private String doctorName;

    @Schema(description = "就诊日期")
    private String date;

    @Schema(description = "就诊编号")
    private String number;

    /**
     * 0: 上午 | 1: 下午
     */
    @Schema(description = "时段")
    private String step;

    @Schema(description = "是否预约")
    private int orderFlag;

    /**
     * 获取时段的显示文本
     * @return 上午/下午
     */
    public String getStepDisplay() {
        return MORNING_SHIFT.equals(this.step) ? "上午" : 
               AFTERNOON_SHIFT.equals(this.step) ? "下午" : "未知时段";
    }

    /**
     * 验证时段值是否有效
     * @return true if valid, false otherwise
     */
    public boolean isValidStep() {
        return Arrays.asList(MORNING_SHIFT, AFTERNOON_SHIFT).contains(this.step);
    }
}